#include "CLayer.h"

CLayer::CLayer(void)
{
	m_nDepth = -1;
}

CLayer::~CLayer(void)
{
	for(unsigned int i = 0; i < m_vTiles.size(); i++)
	{
		delete m_vTiles[i];
	}
	m_vTiles.clear();
}
void CLayer::addTile()
{
	m_vTiles.push_back(new CTile);
}

CLayer::CLayer (CLayer& copied)
{
	this->m_nDepth = copied.GetDepth();
	

	for(unsigned int i = 0; i < copied.GetTiles()->size(); i++)
	{
		addTile();
		m_vTiles[i]->SetHeight(copied.GetTiles()->operator[](i)->GetHeight());
		m_vTiles[i]->SetmX(copied.GetTiles()->operator[](i)->GetmX());
		m_vTiles[i]->SetmY(copied.GetTiles()->operator[](i)->GetmY());
		m_vTiles[i]->SetTrigger(copied.GetTiles()->operator[](i)->GetTrigger());
		m_vTiles[i]->SetType(copied.GetTiles()->operator[](i)->GetType());
		m_vTiles[i]->SetWidth(copied.GetTiles()->operator[](i)->GetWidth());
		m_vTiles[i]->SetX(copied.GetTiles()->operator[](i)->GetX());
		m_vTiles[i]->SetY(copied.GetTiles()->operator[](i)->GetY());
	}
}
